package textviewer.main;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

public class GUIBookSelectorListener  implements OnClickListener {
	private String dest;
	private GUIBookSelector parent;
	private boolean textOrNot= false;
	public GUIBookSelectorListener(GUIBookSelector parent,String dest,boolean textOrNot)
	{
		this.dest=dest;
		this.parent=parent;
		this.textOrNot=textOrNot;
	}
	public void onClick(View v) {
		if(textOrNot)
		{
			Intent int_ent = new Intent(parent, GUIBookSelector.class);
			
			int_ent.putExtra("curr_folder", dest.replaceFirst(FileIO.getRootDirectory(), ""));
			parent.startActivity(int_ent);
			parent.finish();
		}
		else
		{
			parent.download_file(dest);
		}
	}

}
